#ifndef __DEBUG__
// For printing purposes
#define __DEBUG__ 0
#endif

#include <iostream>
#include <cstdint>

#include "../VAR.hpp"
#include "../TERM.hpp"

using namespace std;

void test1() {
  if (__DEBUG__) std::cout << endl << "Beginning Test 1:" << endl;

  constexpr Var<1, false> v;
  constexpr Term<1, Var, false> t(v);
  if (__DEBUG__) std::cout << t << endl;  
  if (__DEBUG__) std::cout << (ConstantTerm)(-2) << endl;  

  int a, b;
  int min = (-2*t).Min(-a,b);
  if (__DEBUG__) std::cout << "\texpr: " << (-2*t) << endl;
  if (__DEBUG__) std::cout << "\tMin: " << min << endl;

  constexpr int min2 = (-2*t).Min(1,10);
  if (__DEBUG__) std::cout << "\tMin2: " << min2 << endl;

  constexpr int min3 = (-2*(-5)*8*t).Min(1,10);
  if (__DEBUG__) std::cout << "\tMin3: " << min3 << endl;

  constexpr int min4 = (-2*(-5+7)*8*t).Min(1,10);
  if (__DEBUG__) std::cout << "\tMin4: " << min4 << endl;

  static_assert(t.cst() > 0, "ERROR");
  // Not static:  static_assert(min == xxx, "ERROR");
  static_assert(min2 ==  -20, "ERROR");
  static_assert(min3 ==   80, "ERROR");
  static_assert(min4 == -320, "ERROR");
}

int main (void) {
  test1();
}
